package com.mysnail.boy.controller;


import com.mysnail.boy.bean.User;
import com.wordnik.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created By XJL On 2017/11/11
 */
@RestController
@RequestMapping("/user")
public class SwaggerController {

    @ApiOperation(value = "Get all users",notes = "requires noting")
    @RequestMapping(method = RequestMethod.GET)
    public List<User> getUsers(){
        List<User> list = new ArrayList<>();
        User user = new User();
        user.setName("Hello");
        list.add(user);

        User user2 = new User();
        user2.setName("World");
        list.add(user2);
        return list;
    }

    @ApiOperation(value = "Get User with id",notes = "requires id of user")
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public User getUserById(@PathVariable("id") Integer id){
       User user = new User();
       user.setName("Hello World!");
        return user;
    }
}
